package uiLayer;

import java.util.Scanner;

public class MenuUI {
	
	public MenuUI(){
		
	}

	/**
     * pause - Waiting for user to press enter.
     */
    @SuppressWarnings("unused")
	protected void pause(){
        Scanner keyboard = new Scanner(System.in);
        String pause = keyboard.nextLine();
    }
    
    /**
     * confirmStatement - Using the user confirmation.
     * @param confirmStatement Text to print with confirm.
     * @return boolean - pressed y = true. n = false.
     */
    protected boolean confirm(String confirmStatement){
        boolean confirm = true;
        Scanner s = new Scanner(System.in);
        boolean exit = false;
        while(!exit){
            System.out.println();
            System.out.println(confirmStatement);
            System.out.println("Confirm - y/n");
            String conf = s.nextLine();
            if(conf.toLowerCase().equals("y")){
                confirm = true;
                exit = true;
            }else if(conf.toLowerCase().equals("n")){
                confirm = false;
                exit = true;
            }
        }
        return confirm;
    }
    
    protected void clearConsole(){
    	System.out.println("\f");
    	/*
    	try{
    		final String os = System.getProperty("os.name");
    		
    		if(os.contains("Windows")){
    			Runtime.getRuntime().exec("cls");
    		}else{
    			Runtime.getRuntime().exec("clear");
    		}
    	}catch(Exception e){
    		System.out.println(e.getMessage());
    	}
    	*/
    }
}
